﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using CommunitySystem.BO.EmpbasicBO;
using CommunitySystemModel;

namespace CommunitySystem.Web.Service
{
    // 注意: 使用“重构”菜单上的“重命名”命令，可以同时更改代码、svc 和配置文件中的类名“EmpBasicService”。
    public class EmpBasicService : IEmpBasicService
    {
        public string GetDengLuJueSe(string loginName)
        {
            return bo.GetDengLuJueSe(loginName);
        }
        #region 基本信息

        private EmpbasicBO bo = new EmpbasicBO();

        public string GetDengLuOrg(string loginName)
        {
            return bo.GetDengLuOrg(loginName);
        }

        public int GetEmp_BasicInfoCounts(string OrgID, string EmpID, string name, string orgtype, string empstatus, string highQueryCondition)
        {
            return bo.GetEmp_BasicInfoCounts(OrgID, EmpID, name, orgtype, empstatus, highQueryCondition);
        }
        public ObservableCollection<CommunitySystemModel.Emp_BasicInfoModel> GetEmp_BasicInfo(string OrgID, string EmpID, string name, string orgname, int start, int end, string empstatus, string highQueryCondition)
        {
            //需要把组织机构ID传过来，这样才能找各个单位的人
            return bo.GetEmp_BasicInfos(OrgID, EmpID, name, orgname,start,end,empstatus, highQueryCondition);
        }
        public int AddEmp_BasicInfo(CommunitySystemModel.Emp_BasicInfoModel item)
        {
            return bo.AddEmp_BasicInfo(item);
        }

        public bool UpdateEmp_BasicInfo(CommunitySystemModel.Emp_BasicInfoModel item)
        {
            return bo.UpdateEmp_BasicInfo(item);
        }

        public bool DeleteEmp_BasicInfo(string ID)
        {
            return bo.DeteleEmp_BasicInfo(ID);
        }

        public ObservableCollection<Emp_BasicInfoModel> GetDanWeiEmp_BasicInfos(string OrgID,string empstatus)
        {
            return bo.GetDanWeiEmp_BasicInfos(OrgID, empstatus);
        }
        #endregion

        #region 职务信息

        public ObservableCollection<Emp_Duty> GetEmp_Dutys(string EmpID, int ID)
        {
            return bo.GetEmp_Dutys(EmpID,ID);
        }


        public bool AddEmp_Duty(Emp_Duty item)
        {
            return bo.AddEmp_Duty(item);
        }


        public bool UpdateEmp_Duty(Emp_Duty item)
        {
            return bo.UpdateEmp_Duty(item);
        }


        public bool DeteleEmp_Duty(int ID)
        {
            return bo.DeteleEmp_Duty(ID);
        }

        #endregion

        #region 简历信息

        public ObservableCollection<Emp_ResumeModel> GetEmp_Resume(string EmpID, int ID)
        {
            return bo.GetEmp_Resume(EmpID,ID);
        }


        public bool AddEmp_Resume(Emp_ResumeModel item)
        {
            return bo.AddEmp_Resume(item);
        }


        public bool UpdateEmp_ResumeModel(Emp_ResumeModel item)
        {
            return bo.UpdateEmp_ResumeModel(item);
        }


        public bool DeteleEmp_ResumeModel(int ID)
        {
            return bo.DeteleEmp_ResumeModel(ID);
        }

        #endregion

        #region 学历信息

        public ObservableCollection<Emp_EducationModel> GetEmp_EducationModel(string EmpID, int ID)
        {
            return bo.GetEmp_EducationModel(EmpID,ID);
        }


        public bool AddEmp_EducationModel(Emp_EducationModel item)
        {
            return bo.AddEmp_EducationModel(item);
        }


        public bool UpdateEmp_EducationModel(Emp_EducationModel item)
        {
            return bo.UpdateEmp_EducationModel(item);
        }


        public bool DeteleEmp_EducationModel(int ID)
        {
            return bo.DeteleEmp_EducationModel(ID);
        }

        #endregion

        #region 学位信息

        public ObservableCollection<Emp_DegreeModel> GetEmp_DegreeModel(string EmpID, int ID)
        {
            return bo.GetEmp_DegreeModel(EmpID,ID);
        }


        public bool AddEmp_DegreeModel(Emp_DegreeModel item)
        {
            return bo.AddEmp_DegreeModel(item);
        }


        public bool UpdateEmp_DegreeModel(Emp_DegreeModel item)
        {
            return bo.UpdateEmp_DegreeModel(item);
        }


        public bool DeteleEmp_DegreeModel(int ID)
        {
            return bo.DeteleEmp_DegreeModel(ID);
        }

        #endregion

        #region 考核信息

        public ObservableCollection<Emp_AssessmentModel> GetEmp_AssessmentModel(string EmpID, int ID)
        {
            return bo.GetEmp_AssessmentModel(EmpID,ID);
        }


        public bool AddEmp_AssessmentModel(Emp_AssessmentModel item)
        {
            return bo.AddEmp_AssessmentModel(item);
        }


        public bool UpdateEmp_AssessmentModel(Emp_AssessmentModel item)
        {
            return bo.UpdateEmp_AssessmentModel(item);
        }


        public bool DeteleEmp_AssessmentModel(int ID)
        {
            return bo.DeteleEmp_AssessmentModel(ID);
        }

        #endregion

        #region 奖惩信息

        public ObservableCollection<Emp_RewardInfoModel> GetEmp_RewardInfoModel(string EmpID, int ID)
        {
            return bo.GetEmp_RewardInfoModel(EmpID,ID);
        }


        public bool AddEmp_RewardInfoModel(Emp_RewardInfoModel item)
        {
            return bo.AddEmp_RewardInfoModel(item);
        }


        public bool UpdateEmp_RewardInfoModel(Emp_RewardInfoModel item)
        {
            return bo.UpdateEmp_RewardInfoModel(item);
        }


        public bool DeteleEmp_RewardInfoModel(int ID)
        {
            return bo.DeteleEmp_RewardInfoModel(ID);
        }

        #endregion

        #region 处分信息

        public ObservableCollection<Emp_PunishmentModel> GetEmp_PunishmentModel(string EmpID, int ID)
        {
            return bo.GetEmp_PunishmentModel(EmpID,ID);
        }


        public bool AddEmp_PunishmentModel(Emp_PunishmentModel item)
        {
            return bo.AddEmp_PunishmentModel(item);
        }


        public bool UpdateEmp_PunishmentModel(Emp_PunishmentModel item)
        {
            return bo.UpdateEmp_PunishmentModel(item);
        }


        public bool DeteleEmp_PunishmentModel(int ID)
        {
            return bo.DeteleEmp_PunishmentModel(ID);
        }

        #endregion

        #region 家庭信息

        public ObservableCollection<Emp_FamilyRelationModel> GetEmp_FamilyRelationModel(string EmpID, int ID)
        {
            return bo.GetEmp_FamilyRelationModel(EmpID,ID);
        }


        public bool AddEmp_FamilyRelationModel(Emp_FamilyRelationModel item)
        {
            return bo.AddEmp_FamilyRelationModel(item);
        }


        public bool UpdateEmp_FamilyRelationModel(Emp_FamilyRelationModel item)
        {
            return bo.UpdateEmp_FamilyRelationModel(item);
        }


        public bool DeteleEmp_FamilyRelationModel(int ID)
        {
            return bo.DeteleEmp_FamilyRelationModel(ID);
        }

        #endregion


        #region 日志管理
        public ObservableCollection<System_MarkManageModel> GetSystemMark(string dengluren, int start, int end, string caozuoren, string caozuoriqi)
        {
            return bo.GetSystemMark(dengluren, start, end, caozuoren, caozuoriqi);
        }

        public bool AddSystem_Mark(string ZiJi, string OldContent, string NewContent, int EmpID, string CaoZuoFangShi, string ZiDuan, string DengLuRen)
        {
            return bo.AddSystem_Mark(ZiJi, OldContent, NewContent, EmpID, CaoZuoFangShi, ZiDuan,DengLuRen);
        }

        public bool UpdateSystem_Mark(System_MarkManageModel item)
        {
            return bo.UpdateSystem_Mark(item);
        }
        #endregion

        #region 组织机构管理
        public ObservableCollection<OrgForHRModel> GetOrgForHRModel(int OrgID)
        {
            return bo.GetOrgForHRModel(OrgID);
        }

        public ObservableCollection<OrgForHRModel> GetOrgForHRModelbyIDs(string OrgID)
        {
            return  bo.GetOrgForHRModelbyIDs(OrgID);
        }

        public bool AddOrgForHRModel(OrgForHRModel item)
        {
            return bo.AddOrgForHRModel(item);
        }

        public bool UpdateOrgForHRModel(OrgForHRModel item)
        {
            return bo.UpdateOrgForHRModel(item);
        }

        public bool DeteleOrgForHRModel(int ID)
        {
            return bo.DeteleOrgForHRModel(ID);
        }
        #endregion

        #region 编制管理
        public ObservableCollection<BianZhiModel> GetBianZhiModel(int OrgID, int ID)
        {
            return bo.GetBianZhiModel(OrgID,ID);
        }

        public bool AddBianZhiModel(BianZhiModel item)
        {
            return bo.AddBianZhiModel(item);
        }

        public bool UpdateBianZhiModel(BianZhiModel item)
        {
            return bo.UpdateBianZhiModel(item);
        }
        public ObservableCollection<BianZhiModel> GetBianZhiModelShiYou(int OrgID)
        {
            return bo.GetBianZhiModelShiYou(OrgID);
        }
        #endregion

        private ExportPersonnelInfoBO ebo = null;
        public FileTransferStream GetPersonnelInfoExcel(int id, string UserName)
        {
            if (ebo == null || ebo._id != id)
                ebo = new ExportPersonnelInfoBO(id);
            return ebo.GetExcelFile(id, UserName);
        }

        public bool CanDaoRuAll(ObservableCollection<Emp_BasicInfoModel> InEmpBasicModels)
        {
            return bo.CanDaoRuAll(InEmpBasicModels);
        }

        public bool ShanChuDaoRuAll(ObservableCollection<Emp_BasicInfoModel> InEmpBasicModels)
        {
            return bo.ShanChuDaoRuAll(InEmpBasicModels);
        }

        public bool DaoRuAll(ObservableCollection<Emp_BasicInfoModel> InEmpBasicModels,
                      ObservableCollection<Emp_EducationModel> InEmpEducation,
                      ObservableCollection<Emp_DegreeModel> InEmpDegree,
                      ObservableCollection<Emp_ResumeModel> InEmpResume,
                      ObservableCollection<Emp_Duty> InEmpDuty, ObservableCollection<Emp_RewardInfoModel> InEmpReward,
                      ObservableCollection<Emp_PunishmentModel> InEmpPunish,
                      ObservableCollection<Emp_AssessmentModel> InEmpAssenssment,
                      ObservableCollection<Emp_FamilyRelationModel> InEmpFamily)
        {
            return bo.DaoRuAll(InEmpBasicModels, InEmpEducation, InEmpDegree, InEmpResume, InEmpDuty, InEmpReward,
                        InEmpPunish, InEmpAssenssment, InEmpFamily);
        }

        public PeiZhiLieModel GetLieByUserID(int userID)
        {
            return bo.GetLieByUserID(userID);
        }

        public bool UpdateLie(PeiZhiLieModel item)
        {
            return bo.UpdateLie(item);
        }

        private ExportPersonnelInfoBO exportBo = null;
        public string ExportPersonnelInfoPosition(int empid, int position)
        {
            if (exportBo == null)
                exportBo = new ExportPersonnelInfoBO(empid);
            return exportBo.ExportPersonnelInfoPosition(empid, position);
        }

        public int GetSystemMarkCounts(string dengluren, string caozuoren, string caozuoriqi)
        {
            return bo.GetSystemMarkCounts(dengluren,caozuoren,caozuoriqi);
        }

        public int GetCheGaiCounts(string caozuoren, string caozuoriqi, string endcaozuoriqi, string orgid, string status, int keyid, string dengjibiandong)
        {
            return bo.GetCheGaiCounts(caozuoren, caozuoriqi, endcaozuoriqi, orgid, status, keyid, dengjibiandong);
        }

        public ObservableCollection<CheGaiModel> GetCheGai(string caozuoren, string caozuoriqi, string endcaozuoriqi, string orgid, string status,
                                                    int start, int end, int keyid, string dengjibiandong)
        {
            return bo.GetCheGai(caozuoren, caozuoriqi, endcaozuoriqi, orgid, status,
                                start, end, keyid, dengjibiandong);
        }

        public CheGaiModel GetOneCheGai(int id)
        {
            return bo.GetOneCheGai(id);
        }

        public bool UpdateCheGai(CheGaiModel item)
        {
            return bo.UpdateCheGai(item);
        }

        public void InsertCheGai(int EmpID, string Type, string dengjibiandongtype)
        {
            bo.InsertCheGai(EmpID,  Type, dengjibiandongtype);
        }

        public bool UpdateCheGaiAll(ObservableCollection<CheGaiModel> item)
        {
            return bo.UpdateCheGaiAll(item);
        }

        public ObservableCollection<string> GetKeyIDs(string caozuoriqi, string endcaozuoriqi, string orgid)
        {
            return bo.GetKeyIDs(caozuoriqi, endcaozuoriqi, orgid);
        }

        public ObservableCollection<ZhiJiModel> GetZhiJiModel(int ID)
        {
            return bo.GetZhiJiModel(ID);
        }
        public bool AddZhiJiModel(ZhiJiModel item)
        {
            return bo.AddZhiJiModel(item);
        }
        public bool UpdateZhiJiModel(ZhiJiModel item)
        {
            return bo.UpdateZhiJiModel(item);
        }

        //public FileTransferStream GetExcelFile(ObservableCollection<CheGaiModel> models)
        //{
        //    return bo.GetExcelFile(models);
        //}
    }
}
